<?php

/**
 * Helper to implementation of hook_content_default_fields().
 */
function _programme_content_default_fields() {
  $fields = array();

  // Exported field: field_materials
  $fields[] = array(
    'field_name' => 'field_materials',
    'type_name' => 'session',
    'display_settings' => array(
      'weight' => '37',
      'parent' => '',
      'token' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '4' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
      'label' => array(
        'format' => 'above',
      ),
      'teaser' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '2' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '3' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
    'widget_active' => '1',
    'type' => 'filefield',
    'required' => '0',
    'multiple' => '1',
    'module' => 'filefield',
    'active' => '1',
    'list_field' => '0',
    'list_default' => 1,
    'description_field' => '0',
    'widget' => array(
      'file_extensions' => '',
      'file_path' => 'materials/[user]',
      'progress_indicator' => 'bar',
      'max_filesize_per_file' => '10M',
      'max_filesize_per_node' => '20M',
      'label' => 'Supporting materials',
      'weight' => '9',
      'description' => 'Supporting materials for your presentation.',
      'type' => 'filefield_widget',
      'module' => 'filefield',
    ),
  );

  // Exported field: field_slides
  $fields[] = array(
    'field_name' => 'field_slides',
    'type_name' => 'session',
    'display_settings' => array(
      'weight' => '36',
      'parent' => '',
      'token' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '4' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'label' => array(
        'format' => 'above',
      ),
      'teaser' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '2' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '3' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
    'widget_active' => '1',
    'type' => 'filefield',
    'required' => '0',
    'multiple' => '0',
    'module' => 'filefield',
    'active' => '1',
    'list_field' => '0',
    'list_default' => 1,
    'description_field' => '0',
    'widget' => array(
      'file_extensions' => 'odp ppt pdf html htm',
      'file_path' => 'materials/[user]',
      'progress_indicator' => 'bar',
      'max_filesize_per_file' => '',
      'max_filesize_per_node' => '',
      'label' => 'Slides',
      'weight' => '8',
      'description' => 'A copy of your slides for delegates to review in their own time.',
      'type' => 'filefield_widget',
      'module' => 'filefield',
    ),
  );

  // Exported field: field_time
  $fields[] = array(
    'field_name' => 'field_time',
    'type_name' => 'session',
    'display_settings' => array(
      'label' => array(
        'format' => 'above',
        'exclude' => 0,
      ),
      'teaser' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '4' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '2' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '3' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
    'widget_active' => '1',
    'type' => 'date',
    'required' => '1',
    'multiple' => '0',
    'module' => 'date',
    'active' => '1',
    'granularity' => array(
      'year' => 'year',
      'month' => 'month',
      'day' => 'day',
      'hour' => 'hour',
      'minute' => 'minute',
    ),
    'timezone_db' => 'UTC',
    'tz_handling' => 'site',
    'todate' => 'required',
    'repeat' => 0,
    'repeat_collapsed' => '',
    'default_format' => 'long',
    'widget' => array(
      'default_value' => 'blank',
      'default_value_code' => '',
      'default_value2' => 'same',
      'default_value_code2' => '+40 minutes',
      'input_format' => 'j M Y - H:i',
      'input_format_custom' => '',
      'increment' => '5',
      'text_parts' => array(),
      'year_range' => '-0:+3',
      'label_position' => 'above',
      'label' => 'Time',
      'weight' => '7',
      'description' => 'Start and end time.',
      'type' => 'date_popup',
      'module' => 'date',
    ),
  );

  // Exported field: field_track
  $fields[] = array(
    'field_name' => 'field_track',
    'type_name' => 'session',
    'display_settings' => array(
      'weight' => '32',
      'parent' => '',
      'token' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '4' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'label' => array(
        'format' => 'above',
      ),
      'teaser' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '2' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '3' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
    'widget_active' => '1',
    'type' => 'text',
    'required' => '1',
    'multiple' => '0',
    'module' => 'text',
    'active' => '1',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => 'Innovation
Development
Collaboration
All',
    'allowed_values_php' => '',
    'widget' => array(
      'default_value' => array(
        '0' => array(
          'value' => '',
        ),
      ),
      'default_value_php' => NULL,
      'label' => 'Track',
      'weight' => '3',
      'description' => 'The track this session is to appear in.',
      'type' => 'optionwidgets_select',
      'module' => 'optionwidgets',
    ),
  );

  // Exported field: field_weight
  $fields[] = array(
    'field_name' => 'field_weight',
    'type_name' => 'session',
    'display_settings' => array(
      'weight' => '33',
      'parent' => '',
      'token' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
      '4' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
      'label' => array(
        'format' => 'above',
      ),
      'teaser' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
      'full' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
      '2' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
      '3' => array(
        'format' => 'default',
        'exclude' => 1,
      ),
    ),
    'widget_active' => '1',
    'type' => 'number_integer',
    'required' => '1',
    'multiple' => '0',
    'module' => 'number',
    'active' => '1',
    'prefix' => '',
    'suffix' => '',
    'min' => '',
    'max' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'widget' => array(
      'default_value' => array(
        '0' => array(
          'value' => '0',
          '_error_element' => 'default_value_widget][field_weight][0][value',
        ),
      ),
      'default_value_php' => NULL,
      'label' => 'Weight',
      'weight' => '4',
      'description' => 'The lower the weight the higher up the sort order this node will appear.',
      'type' => 'number',
      'module' => 'number',
    ),
  );

  // Translatables
  array(
    t('Slides'),
    t('Supporting materials'),
    t('Time'),
    t('Track'),
    t('Weight'),
  );

  return $fields;
}

/**
 * Helper to implementation of hook_user_default_permissions().
 */
function _programme_user_default_permissions() {
  $permissions = array();

  // Exported permission: create session content
  $permissions[] = array(
    'name' => 'create session content',
    'roles' => array(
      '0' => 'author_role',
      '1' => 'editor',
      '2' => 'site_manager',
      '3' => 'speaker',
    ),
  );

  // Exported permission: delete any session content
  $permissions[] = array(
    'name' => 'delete any session content',
    'roles' => array(
      '0' => 'editor',
      '1' => 'site_manager',
    ),
  );

  // Exported permission: delete own session content
  $permissions[] = array(
    'name' => 'delete own session content',
    'roles' => array(
      '0' => 'site_manager',
    ),
  );

  // Exported permission: edit any session content
  $permissions[] = array(
    'name' => 'edit any session content',
    'roles' => array(
      '0' => 'editor',
      '1' => 'site_manager',
    ),
  );

  // Exported permission: edit field_slides
  $permissions[] = array(
    'name' => 'edit field_slides',
    'roles' => array(
      '0' => 'author_role',
      '1' => 'editor',
      '2' => 'site_manager',
      '3' => 'speaker',
    ),
  );

  // Exported permission: edit field_time
  $permissions[] = array(
    'name' => 'edit field_time',
    'roles' => array(
      '0' => 'editor',
      '1' => 'site_manager',
    ),
  );

  // Exported permission: edit field_track
  $permissions[] = array(
    'name' => 'edit field_track',
    'roles' => array(
      '0' => 'editor',
      '1' => 'site_manager',
    ),
  );

  // Exported permission: edit own session content
  $permissions[] = array(
    'name' => 'edit own session content',
    'roles' => array(
      '0' => 'site_manager',
      '1' => 'speaker',
    ),
  );

  // Exported permission: view field_materials
  $permissions[] = array(
    'name' => 'view field_materials',
    'roles' => array(
      '0' => 'anonymous user',
      '1' => 'authenticated user',
      '2' => 'author_role',
      '3' => 'editor',
      '4' => 'site_manager',
      '5' => 'speaker',
    ),
  );

  // Exported permission: view field_slides
  $permissions[] = array(
    'name' => 'view field_slides',
    'roles' => array(
      '0' => 'anonymous user',
      '1' => 'authenticated user',
      '2' => 'author_role',
      '3' => 'editor',
      '4' => 'site_manager',
      '5' => 'speaker',
    ),
  );

  // Exported permission: view field_time
  $permissions[] = array(
    'name' => 'view field_time',
    'roles' => array(
      '0' => 'anonymous user',
      '1' => 'authenticated user',
      '2' => 'author_role',
      '3' => 'editor',
      '4' => 'site_manager',
      '5' => 'speaker',
    ),
  );

  // Exported permission: view field_track
  $permissions[] = array(
    'name' => 'view field_track',
    'roles' => array(
      '0' => 'anonymous user',
      '1' => 'authenticated user',
      '2' => 'author_role',
      '3' => 'editor',
      '4' => 'site_manager',
      '5' => 'speaker',
    ),
  );

  return $permissions;
}
